package com.macro.mall.tiny.modules.ums.controller.job;

import com.macro.mall.tiny.modules.ums.service.CourseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @author: i_kun
 * @Desc: o_。
 * @create: 2025-07-01 09:13
 */
@Component
public class CourseJob {
    @Autowired
    private CourseService courseService;

    /**
     * 5秒钟执行一次
     */
    @Scheduled(fixedRate = 5000)
    private void demo1(){
        System.out.println("本次demo1执行时间"+System.currentTimeMillis());
    }

    /**
     * 每五秒执行一次此方法
     */
    @Scheduled(cron = "0/5 * * * * ?")
    private void demo2(){
        courseService.demo2();
    }
}
